<?php

namespace RSP\ReseauSocialBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
  public function indexAction()
  {
       return $this->render('RSPReseauSocialBundle:Default:index.html.twig');
    }
     public function profileAction()
  {
       return $this->render('RSPUserBundle:Profile:show.html.twig');
    }
     public function localeAction()
  {
       return $this->render('RSPUserBundle:Profile:locale.html.twig');
    }
    public function infosAction()
  {
       return $this->render('RSPUserBundle:Profile:infos.html.twig');
    }
     public function messageAction()
  {
       return $this->render('RSPUserBundle:Message:message.html.twig');
    }
     public function accueilAction()
  {
       return $this->render('RSPReseauSocialBundle:Accueil:accueil.html.twig');
    }
    
   
    public function photoAction()
  {
       return $this->render('RSPReseauSocialBundle:Default:photo.html.twig');
    }
     
    public function ajaxGetVilleParPaysAction(){
        $request= $this->getRequest();
        $idPays=$request->get('id_pays');
        $em = $this->getDoctrine()->getEntityManager();
        $repository=$em->getRepository('RSPReseauSocialBundle:Ville');
        
        $repository1=$em->getRepository('RSPReseauSocialBundle:Pays');
        $pays=$repository1->find($idPays);
        $villes=$repository->findBy(array('pays'=>$pays));
        return $this->render('RSPReseauSocialBundle:Default:listVilleSelect.html.twig',array('villes'=>$villes));
    }
}
